package com.zombie.effect;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.zombie.logic.object.GameObject;

public class TracerEffect extends AbstractEffect{

	public Color start;
	public Color finish;
	private GameObject owner;
	float alphaStart  = 1.0f;
	float alphaFinish  = 1.0f;
	
	
	float startLifeTime, finishLifeTime;
	
	public TracerEffect(){
		start = Color.GRAY;
		finish = Color.WHITE;
	}
	
	@Override
	public void update(int delta) {
		setLifeTime(getLifeTime() - delta);
//		Line l = (Line) getShape();
//		l.set(getOwner().position.x, getOwner().position.y, l.getX2(), l.getY2());
//		
//		float onePercent = getFullLifeTime()/2/100f;
//		float percents = getLifeTime()/2/onePercent;
//		alphaStart = percents*0.01f;
//		onePercent = getFullLifeTime()/100f;
//		percents = getLifeTime()/onePercent;
//		alphaFinish = percents*0.01f;
//		start = new Color(start.getRed(),start.getGreen(),start.getBlue(),alphaStart/2);
//		finish = new Color(finish.getRed(),finish.getGreen(),finish.getBlue(),alphaFinish/2);
	}

	@Override
	public void draw(SpriteBatch batch, ShapeRenderer shapeBatch) {
//		GradientFill gf = new GradientFill(new Vector2f(getShape().getPoint(0)[0],getShape().getPoint(0)[1]), finish, new Vector2f(getShape().getPoint(1)[0],getShape().getPoint(1)[1]),start , false);
//		g.setLineWidth(0.8f);
////		GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_ALPHA);
//
//		g.draw(getShape(),gf);
//		g.setLineWidth(1f);
//		g.setDrawMode(Graphics.MODE_NORMAL);
	}

	public GameObject getOwner() {
		return owner;
	}

	public void setOwner(GameObject owner) {
		this.owner = owner;
	}

	@Override
	public void remove() {
		// TODO Auto-generated method stub
		
	}

}
